<html>
<head>
    <link rel="dns-prefetch" href="//tmall.fc62.com">
    <link rel="dns-prefetch" href="http://uploadfile.fc62.com">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>{$row.name}</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/zhaomu.css"/>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/questionnaire.css"/>

    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/questionnaire1.css"/>

    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/layer.css" />
    <script src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/jquery.1.9.1.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/rem.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.css" />
    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head>
<body class="body_tj">
<script>
    wx.config({$jssdk});
    // wx.ready(function(){
    //   wx.hideMenuItems({
    //     menuList: ['menuItem:share:appMessage',"menuItem:share:timeline"]
    //   });
    // });
    wx.ready(function(){
        wx.hideOptionMenu()
    });
</script>
{if $row['is_source'] == 1}
<script>
   var referer_return = "{$referer_return}";
   var referer_url = "{$referer_url}";
    //非法来源注释
    if(!referer_return){
        layer.open({
            content: '请在直播间点击链接领取',//您未认真听讲或未认真答题，请重新答题
            skin: 'msg',
            time: 4,
        });
        setTimeout(function(){
            window.location.href = 'https://shoptest.fc62.com/index_activity/215';
        }, 4000);

    }
    console.log("来源  "+referer_url);
</script>
{/if}

<style>
    .quechoose p{padding-top: 0.45rem;}
    .buttonbuy{margin: 0.4rem auto;width: 3rem;height: 0.55rem;border: 1px solid #0aa5f4;color: #0aa5f4;background-color: #fff;border-radius: 17px;text-align: center;line-height: 0.55rem;font-size: 0.28rem;margin-bottom: 0.5rem;display: block;text-decoration: none;}

</style>
{if $dati == 0}
<div id="wenjuanqqwe">
    <img style="width: 100%;" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/question_top7.jpg"/>


    <ul class="question">
        <div class="quechoose">
            <p>购买产品者，赠书随产品附赠，无需填写问卷，点击下方按钮进入购买页面即可。</p>
            <a href="https://shoptest.fc62.com/index_activity/215?source=sc
" class="buttonbuy">进入购买页面</a>
            <p style="border-top: 1px solid #f4f4f4;">不购买产品者，请填写下方“听课效果问卷”，正确填写后，点击问卷底部“点击领取”按钮， 进入领取界面。</p>
        </div>
        {foreach name="$info" item="vo"}
        <li>
            <p>{$key+1}. {$vo['name']} {if $vo['must_fil'] == 1}<span style="color: #ff0000;">*</span>{/if}</p>
            <input type="hidden" id="wenjuan{$key}" value="{$vo['must_fil']}" />
            <input type="hidden" id="wenjuantype{$key}" value="{$vo['type']}" />
            {if $vo['type'] == 1}
            {foreach name="$vo['timu']" key="k" item="v" }
            <p>
                <input  type="radio"  class="question-radio" name="wenjuan{$key}" id="a{$key}{$k}" value="{$vo['id']}-{$v['name']}-{$v['answer']}" />

                <label class="radio-label question-label" for="a{$key}{$k}"><span>{$v['name']}.{$v['answer']}</span></label>
            </p>
            {/foreach}
            {elseif $vo.type == 2}
            {foreach name="$vo['timu']" key="k" item="v" }
            <p>
                <input type="checkbox" name="wenjuan{$key}" id="a{$key}{$k}" value="{$vo['id']}-{$v['name']}-{$v['answer']}" />
                <label class="checkbox-label" for="a{$key}{$k}"><span>{$v['name']}.{$v['answer']}</span></label>
            </p>
            {/foreach}
            {/if}
        </li>
        {/foreach}

    </ul>

    <div class="question_mid">
        <p class="mid_top">感谢您的答题！祝孩子考出最好的自己，高考成功！</p>
        <div>
            <p class="mid_mid">
            <p class="ktkj ylfx">提交问卷后，查看《高考一轮复习方向作业》电子版样张并领取纸质版</p>
            <span class="question_submit">点击领取</span>
            </p>
        </div>
        <!--<p class="mid_bottom">* 语文为不公开领取，只公布电子版样张供家长参考</p>-->
    </div>
    <!-- <div class="question_mid">
        <img class="mid_img" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/mid_top.jpg"/>
        <img class="mid_img question_submit" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/mid_mid.jpg"/>
        <p class="mid_bottom">* 语文为不公开领取，只公布电子版样张供家长参考</p>
    </div> -->

</div>
<script>
    var count = {:count($info)};
    var jsonData={};
    $(function(){
        $('.question_submit').click(function(){


            for (var i = 0; i < count; i++) {
                var type= $("#wenjuantype"+i).val();
                console.log(type);
                if(type == 1){
                    var wenjuan = $("input[name='wenjuan"+i+"']:checked").val();
                }else if(type == 2){
                    var wenjuan = "";
                    $("input[name='wenjuan"+i+"']:checked").each(function(){
                        wenjuan += $(this).val() + "||";
                    });
                    if(wenjuan.length > 0){
                        wenjuan = wenjuan.substring(0, wenjuan.length - 2); //把最后一个逗号去掉
                    }
                    console.log(wenjuan);
                }
                var must_fil= $("#wenjuan"+i).val();

                if(must_fil == 1){
                    if(wenjuan == ""||wenjuan == null){
                        layer.open({
                            content: '请填写听课效果问卷后点击领取',
                            skin: 'msg',
                            time: 2 //2秒后自动关闭
                        });
                        return false;
                    }
                }
                jsonData['wenjuan'+i] = wenjuan;
            }
            console.log(jsonData);
            $.ajax({
                type: 'post',
                url:"/index/ques/volumepost/ids/{$row['id']}" ,
                data:jsonData,
                success: function(data) {
                    if (data.code == 0) {
                        layer.open({
                            content: data.msg,//您未认真听讲或未认真答题，请重新答题
                            skin: 'msg',
                            time: 2,
                        });
                        return false;
                    } else {
                        // layer.open({
                        //   content: data.msg,//您未认真听讲或未认真答题，请重新答题
                        //   skin: 'msg',
                        //   time: 2,
                        // });
                        // setTimeout(function(){
                        //     window.location.reload();
                        // }, 2000);
                        window.scroll(0, 0);
                       location.reload();

                    }
                }
            });
        });
    });
</script>
<!--问卷结束-->
{else}

{if !$edit}
<!-- add表单开始   -->
<div class="addressmone" style="display: block;">

    <div class="question_mid">
        <a href="http://uploadfile.fc62.com/ques/%E6%96%B9%E5%90%91%E4%BD%9C%E4%B8%9A%E5%8D%B7-%E6%B1%9F%E8%8B%8F%E7%BB%84%E5%90%88.pdf"><img class="mid_img" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/question_mid3.jpg"/></a>
    </div>
    <ul>
        <!--<li>-->
            <!--<p style="font-size: 0.3rem;color: #666;">纸质版领取,请选择送达方式并填写寄送地址</p>-->
            <!--<div style="margin-top: 0.2rem;" class="radio_sxx">-->
                <!--<input type="radio" name="way" id="way1" value="1" checked />-->
                <!--<label class="radio-labels" for="way1"><span class="way">送学校（10天内送达）</span></label>-->
                <!--<p class="radioinfo">*免邮费</p>-->
            <!--</div>-->
            <!--<div style="margin-top: 0.2rem;" class="radio_xxq">-->
                <!--<input type="radio" name="way" id="way2" value="2" />-->
                <!--<label class="radio-labels" for="way2"><span class="way">线下取</span></label>-->
                <!--<p class="radioinfo">*呼和浩特市新城区西护城河巷内蒙古教育图书广场卓越书店（新世纪广场对面锦江之星旅馆西巷往北150米处路东）（上午9:00-12:00；下午14:00-17:00）</p>-->
            <!--</div>-->
            <!--<div style="margin-top: 0.2rem;" class="radio_fyf">-->
                <!--<input type="radio" name="way" id="way3" value="3" />-->
                <!--<label class="radio-labels" for="way3"><span class="way">错过本地领取的学校或需要寄送到家（3天内寄出）</span></label>-->
                <!--<p class="radioinfo">*9元邮费</p>-->
            <!--</div>-->
        <!--</li>-->
        <li>纸质版领取，赠书将直接送到学校，请选择领 取登记信息中的学校及所在班级，然后提交。</li>
        <li>
            <p class="form_con">学生姓名 <span style="color: #ff0000;">*</span></p>
            <input type="text" name="consignee" value="{$name}" id="name" >
            <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_1.jpg"/>
        </li>
        <li>
            <p class="form_con">家长姓名 <span style="color: #ff0000;">*</span></p>
            <p class="tips">用于领书确认联络</p>
            <input type="text" name="parent_name" value="{$cname}" id="parent_name" >
            <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_1.jpg"/>
        </li>
        <li style="position: relative;">
            <p class="form_con">所在学校/班级 <span style="color: #ff0000;">*</span></p>
            <div id="trigger5" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 100%;height: 35px;line-height: 35px;border-radius: 5px;overflow: hidden;">
                <span style="color: #666;">所在学校/班级</span>
            </div>
            <img style="position: absolute;bottom: 0.3rem;left: 92%;width: 0.26rem;height: 0.13rem;" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/tj.png"/>
            <input type="hidden" name="" id="school" value="" />
            <input type="hidden" name="" id="classname" value="" />
        </li>

        <div class="hide" style="position: relative;">
            <img class="selectjt" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/tj.png" alt="">
            <select class="selectchoose" name="totalschool" id="totalschool" value="">
                <option value ="0">请选择学校</option>
                {foreach name="$base_school" item="vobasc"}
                <option value ="{$vobasc->id}">{$vobasc->name}</option>
                {/foreach}
            </select>
        </div>
        <li class="hide">
            <p class="form_con">班级 <span style="color: #ff0000;">*</span></p>
            <input type="text" name="qitaclassname" value="" id="qitaclassname" >
            <img src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_4.jpg"/>
        </li>
        <!--<li style="position: relative;">-->
            <!--<p class="form_con">所在地区 <span style="color: #ff0000;">*</span></p>-->
            <!--<div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 100%;height: 35px;line-height: 35px;border-radius: 5px;overflow: hidden;">-->
                <!--<span style="color: #666;">{$area.address_text??'请选择'}</span>-->
            <!--</div>-->
            <!--<img style="position: absolute;bottom: 0.3rem;left: 92%;width: 0.26rem;height: 0.13rem;" src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/tj.png"/>-->
            <!--<input type="hidden" name="" id="sheng" value="{$area.province??''}" />-->
            <!--<input type="hidden" name="" id="shi" value="{$area.city??''}" />-->
            <!--<input type="hidden" name="" id="xian" value="{$area.area??''}" />-->
        <!--</li>-->

        <!--<li>-->
            <!--<p class="form_con">详细地址 <span style="color: #ff0000;">*</span></p>-->
            <!--<textarea name="address" id="address" placeholder="用户寄达赠书使用，请认真填写"></textarea>-->
        <!--</li>-->
        <li>
            <p class="form_con">联系电话 <span style="color: #ff0000;">*</span></p>
            <input type="number" pattern="[0-9]*" name="" id="tel" value="{$mobile}" />
            <img  src="http://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/form_2.jpg"/>
        </li>

    </ul>

    <div class="dotm_btn">
        <input type="submit" value="提交" class="dotm_btn1">
    </div>

</div>

<script>
    var volume_id = '{$row["id"]}';
     document.title = '领取登记';
    $(function(){
       
        // var arrarea = [];
        // var province = "{$area.province??1}";
        // var city = "{$area.city??2}";
        // var area = "{$area.area??3}";
        // var province_more = '';
        // var city_more = '';
        // var area_more = '';
        // $.ajax({
        //     type: "post",
        //     url: "/api/ajax/area",
        //     dataType: "json",
        //     async: false,
        //     success: function(res){
        //         arrarea = res.data;
        //         console.log(arrarea);
        //     }
        // });
        // for (var i = 0; i < arrarea.length; i++) {
        //     if(province == arrarea[i]['id']){
        //         province_more = i;
        //         for (var s = 0; s < arrarea[i]['childs'].length; s++) {
        //             if(city == arrarea[i]['childs'][s]['id']){
        //                 city_more = s;
        //                 for (var a = 0; a < arrarea[i]['childs'][s]['childs'].length; a++) {
        //                     if(area == arrarea[i]['childs'][s]['childs'][a]['id']){
        //
        //                         area_more = a;
        //                     }
        //                 }
        //             }
        //         }
        //     }
        // }
        // console.log(province_more);
        // console.log(city_more);
        // var mobileSelect4 = new MobileSelect({
        //     trigger: '#trigger4',
        //     title: '地区选择',
        //     wheels: [{data:arrarea}],
        //     position:[province_more,city_more,area_more],
        //     callback:function(indexArr, data){
        //         $('#sheng').val(data[0].id);
        //         $('#shi').val(data[1].id);
        //         $('#xian').val(data[2].id);
        //     }
        // });

        //学校班级联动
        var mobileSelect5 = new MobileSelect({
            trigger: '#trigger5',
            title: '学校选择',
            wheels: [{data:[
                    {
                        id:'1',
                        value:'',
                        childs:[
                            {id:'A1',value:''},
                        ]
                    }
                ]}],
            transitionEnd:function(indexArr, data){

            },
            callback:function(indexArr, data){
                console.log(data);
                $('#school').val(data[0].id);
                if(data[0].id == -1){
                    $(".hide").show();
                }else{
                    $('#classname').val(data[1].value);
                    $(".hide").hide();
                }
            }
        });
        $.ajax({
            type: "get",
            url: "https://oa.fc62.com/api/ajax/ques_school/ids/"+volume_id,
            dataType: "json",
            success: function(res){
                var qita = {
                    id:"-1",
                    value:"错过本地领取的学校",
                    childs:[]
                }
                res.data.push(qita);
                mobileSelect5.updateWheels(res.data);
            }
        });
        //点击获取验证码
        $('.huoqu').click(function() {
            var tel = $('#tel').val();
            console.log(tel);
            if(!(/^1[3456789]\d{9}$/.test(tel))) {
                layer.open({
                    content: '请输入正确的手机号码',
                    skin: 'msg',
                    time: 2 //2秒后自动关闭
                });
                return false;
            }
            $.ajax({
                type: 'post',
                url:"/api/sms/send" ,
                data:{mobile:tel,event:'schoolques'},
                success: function(data){
                    console.log(data);
                    if(data.code != 1){
                        layer.open({
                            content:data.msg ,
                            skin: 'msg',
                            time: 2 //2秒后自动关闭
                        });
                        return false
                    }else{
                        var count = 120;
                        const countDown = setInterval(() => {
                            if (count === 0) {
                                $('.huoqu').val('重新发送').removeAttr('disabled');
                                $('.huoqu').css({
                                    background: '#f3494c',
                                    color: '#fff',
                                });
                                clearInterval(countDown);
                            } else {

                                $('.huoqu').css({
                                    background: '#eee',
                                    color: '#333',
                                });
                                $('.huoqu').val(count + '秒后可重新获取');
                                $('.huoqu').attr('disabled', true);
                            }
                            count--;
                        }, 1000);
                    }
                }
            });
        });
        //点击提交按钮
        $('.dotm_btn1').click(function(){
           /* var ways=document.getElementsByName('way');
            let waysVal;
            for (var i = 0; i < ways.length; i++) {
                if (ways[i].checked)
                    waysVal=ways[i].value;
            }


            var sheng = $('#sheng').val();
            var shi = $('#shi').val();
            var xian = $('#xian').val();*/
            var code = $('#code').val();
            var name = $('#name').val();//学生姓名
            var parent_name = $('#parent_name').val();
            var tel = $('#tel').val();
            //var address = $('#address').val();
            var school = $('#school').val();//选择学校
            var totalschool = $('#totalschool').val();//全部学校
            var classname = $('#classname').val();//班级
            var qitaclassname = $('#qitaclassname').val();//班级
            //var type = $("input[name='type']:checked").val();//版本
            // var arr =[];
            // $('input[name="subject"]:checked').each(function(){
            // 	arr.push($(this).val());
            // });
            // var subject = arr.join();//学科
            if(name == ""||name == null){
                layer.open({
                    content: '请填写学生姓名',
                    skin: 'msg',
                    time: 2 //2秒后自动关闭
                });
                return false;
            }
            if(parent_name == ""||parent_name == null){
                layer.open({
                    content: '请填写家长姓名',
                    skin: 'msg',
                    time: 2 //2秒后自动关闭
                });
                return false;
            }

            if(school == ""||school == null){
                layer.open({
                    content: '请选择学校',
                    skin: 'msg',
                    time: 2 //2秒后自动关闭
                });
                return false;
            }else if(school == -1){
                if(totalschool == 0){
                    layer.open({
                        content: '请选择学校',
                        skin: 'msg',
                        time: 2 //2秒后自动关闭
                    });
                    return false;
                }
                if(qitaclassname == ""||qitaclassname == null){
                    layer.open({
                        content: '请填写班级',
                        skin: 'msg',
                        time: 2 //2秒后自动关闭
                    });
                    return false;
                }else{
                    classname = qitaclassname;
                }
            }
            // if(sheng == ""||sheng == null){
            //     layer.open({
            //         content: '请选择所在地区',
            //         skin: 'msg',
            //         time: 2 //2秒后自动关闭
            //     });
            //     return false;
            // }
            // if(address == ""||address == null){
            //     layer.open({
            //         content: '请填写详细地址',
            //         skin: 'msg',
            //         time: 2 //2秒后自动关闭
            //     });
            //     return false;
            // }


            if(!(/^1[3456789]\d{9}$/.test(tel))) {
                layer.open({
                    content: '请输入正确的手机号码',
                    skin: 'msg',
                    time: 2 //2秒后自动关闭
                });
                return false;
            }

            // if(type == ""|| type == null){
            //     layer.open({
            //         content: '请选择领取版本',
            //         skin: 'msg',
            //         time: 2 //2秒后自动关闭
            //     });
            //     return false;
            // }


            var index = layer.open({type: 2});

            $.ajax({
                type: 'post',
                url:"/index/ques/school" ,
                dataType:'json',
                data:{name:name,parent_name:parent_name,phone:tel,school:school,totalschool:totalschool,classname:classname,volume_id:volume_id},
                success: function(data){

                    if(data.code == 0){
                        layer.close(index);
                        $('.dotm_btn1').removeAttr("disabled");
                        layer.open({
                            content: data.msg,
                            skin: 'msg',
                            time: 2,
                        });
                        return false;
                    }else if(data.code==2){
                        layer.close(index);
                        wx.chooseWXPay({
                            timestamp: data.timeStamp,
                            nonceStr: data.nonceStr,
                            package: data.package,
                            signType: data.signType,
                            paySign: data.paySign, // 支付签名
                            success: function (res) {
                                // 支付成功后的回调函数
                                if (res.errMsg == "chooseWXPay:ok") {
                                    // alert('支付成功');
                                    window.location.href="https://shoptest.fc62.com/activity/submit_success/32?source=sc";
                                    // window.location.reload();
                                    $('.dotm_btn1').removeAttr("disabled");
                                } else {
                                    alert(res.errMsg,null);
                                    $('.dotm_btn1').removeAttr("disabled");
                                }
                            },
                            cancel: function(r) {
                                alert('取消支付');
                                $('.dotm_btn1').removeAttr("disabled");
                            },
                            fail:function(r){
                                alert('fail支付失败了');
                                $('.dotm_btn1').removeAttr("disabled");
                                //支付失败
                            }

                        });


                    }else{
                        layer.close(index);
                        //var findlUrl = 'https://shoptest.fc62.com/activity/submit_success/32?source=sc'
                        window.location.href=data.data;
                    }

                }
            });

        });

    });
</script>
<!--  add表单结束  -->
{else}

<!-- edit表单开始   -->
{/if}
{/if}

</body>

</html>